#pragma once
#include "stdafx.h"
#include "..\ShowLog\LogUtil.h"
#include "SocketClientMgr.h"

class MainFrame : public WindowImplBase,public SocketClientMgr::Listener
{
public:
    virtual void SCM_OnStartCreateConnectBegin();
    virtual void SCM_OnStartCreateConnectEnd(const bool is_succ, const std::string err, const int type);

    virtual void SCM_OnDisconnect(){ log_->SendLog("SCM_OnDisconnect"); };

    virtual void SCM_OnReConnectBegin(){ log_->SendLog("SCM_OnDisconnect"); };
    virtual void SCM_OnReConnectEnd(const bool is_succ, const int type){};

    virtual void SCM_OnSendMessageBegin(){ log_->SendLog("SCM_OnSendMessageBegin"); };
    virtual void SCM_OnSendMessageEnd(const bool is_succ, const int type);

    virtual void SCM_OnReceiveBegin(){ log_->SendLog("SCM_OnReceiveBegin"); };
    virtual void SCM_OnReceiveEnd(const bool is_succ, const int type, const char* msg);
    virtual void SCM_OnStatuChange(int statu);

    MainFrame();
    ~MainFrame();
    void InitWindow();
    virtual CDuiString GetSkinFile() override { return _T("client.xml"); };
    virtual CDuiString GetSkinFolder() override { return L""; };
    virtual LPCTSTR GetWindowClassName() const { return _T("MainFrame"); }
    void    Notify(TNotifyUI& msg);
private:
    void OnCreateConnect();
    void OnDisConnect();
    void OnReConnect();
    void OnSendMsg();
    void OnStartGet();
    void SetMsg(const std::wstring msg);
    LogUtil* log_;
    SocketClientMgr* mgr_ = nullptr;
    std::wstring client_msg_;
    CRichEditUI* get_str;
};

